<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script src="./lib/vue.js"></script>
</body>

</html>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./lib/vue.js"></script>
</head>

<body>
  <div id="app">
    <input type="text" v-phone v-model="phone">
  </div>

  <script type="module">
    import validator from './lib/Validator.js';

    // 参数2要是为函数时，则表示这bind和update
    Vue.directive('phone', validator.phone)

    let vm = new Vue({
      el: '#app',
      data: {
        phone: '13821521251',
      }
    })
  </script>
</body>

</html>